import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params: query
  })
}

// 添加角色
export function addRole(data) {
  return request({
    url: '/system/role/',
    method: 'post',
    data: data
  })
}

// 根据ID查询角色
export function getRole(data) {
  return request({
    url: '/system/role/' + data,
    method: 'get'
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/system/role',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(ids) {
  return request({
    url: '/system/role/' + ids,
    method: 'delete'
  })
}

// 获取树形结构的菜单
export function getTreeMenus(id) {
  return request({
    url: '/system/role/treeMenus/' + id,
    method: 'get'
  })
}

// 更新角色的菜单权限
export function updateRoleMenus(data) {
  return request({
    url: '/system/role/updateRoleMenus',
    method: 'post',
    data: data
  })
}
